package com.aspose.cells;

class zaxd extends zaxa {
   private zuq c;
   private zun d;
   private short e;
   private short f;
   private int g = -1;
   private boolean h = false;
   private int i = -1;
   private int j = -1;
   private zfv k;
   private zagu l;

   public zaxd(zaay var1, zuq var2, int var3, int var4) {
      super(var1);
      this.c = var2;
      this.e = (short)var3;
      this.f = (short)var4;
      this.d = var2.c(var3, var4);
   }

   public zahn b(zaay var1) {
      zaxd var2 = new zaxd(var1 == null ? this.a : var1, this.c, this.e, this.f);
      if (this.h) {
         var2.h = true;
         var2.i = this.i;
         var2.j = this.j;
      }

      var2.k = this.k;
      var2.l = this.l;
      return var2;
   }

   public int c() {
      return 1;
   }

   public int d() {
      return this.f - this.e + 1;
   }

   public int e() {
      return this.d();
   }

   public boolean l() {
      return false;
   }

   public boolean m() {
      return true;
   }

   public boolean n() {
      return false;
   }

   public zagu a(int var1, int var2) {
      if (this.h) {
         if (var2 < this.i || var2 > this.j) {
            return zzk.a;
         }

         if (this.i == this.j) {
            return this.l;
         }
      }

      return this.a(this.c, var2 + this.e);
   }

   public void f() {
      if (this.h) {
         if (this.i < this.j) {
            this.d.b();
         } else if (this.i > -1) {
            this.b.a = 0;
         }
      } else {
         this.d.b();
      }

   }

   public boolean b(int var1, int var2) {
      return this.a(var2);
   }

   public boolean a(int var1) {
      if (this.h) {
         if (this.i < 0) {
            return false;
         }

         if (var1 <= this.i) {
            if (this.i < this.j) {
               this.d.b();
               return this.g();
            }

            this.b.a = 0;
            return true;
         }

         if (var1 > this.j) {
            return false;
         }

         var1 += this.e;
      } else {
         if (var1 <= 0) {
            this.d.b();
            return this.g();
         }

         var1 += this.e;
         if (var1 > this.f) {
            return false;
         }
      }

      if (this.g == var1) {
         return true;
      } else if (!this.d.a(var1)) {
         return false;
      } else {
         this.k = this.d.a();
         if (this.k.c != 0) {
            this.g = this.k.a - this.e;
            this.l = null;
            return true;
         } else {
            do {
               if (!this.d.hasNext()) {
                  return false;
               }

               this.k = this.d.a();
            } while(this.k.c == 0);

            this.g = this.k.a - this.e;
            this.l = null;
            return true;
         }
      }
   }

   public boolean g() {
      if (this.h) {
         if (this.i < 0) {
            return false;
         }

         if (this.i == this.j) {
            if (this.b.a < 0) {
               return false;
            }

            this.b.a = -1;
            return true;
         }
      }

      if (this.d.hasNext()) {
         this.k = this.d.a();
         if (this.k.c != 0) {
            this.g = this.k.a - this.e;
            this.l = null;
            return true;
         }

         while(this.d.hasNext()) {
            this.k = this.d.a();
            if (this.k.c != 0) {
               this.g = this.k.a - this.e;
               this.l = null;
               return true;
            }
         }
      }

      return false;
   }

   public zagu h() {
      if (this.l == null) {
         this.l = zaaq.a(this.k, this.a);
      }

      return this.l;
   }

   public int i() {
      return 0;
   }

   public int j() {
      return this.g;
   }

   public int k() {
      return this.g;
   }

   public zahn b(int var1) {
      return this;
   }

   public zahn c(int var1) {
      return new zaya(this.a(this.c, var1 + this.e));
   }

   public boolean q() {
      return this.h;
   }

   public int t() {
      if (!this.h) {
         this.C();
      }

      return this.i;
   }

   public int u() {
      if (!this.h) {
         this.C();
      }

      return this.j;
   }

   public int r() {
      if (!this.h) {
         this.C();
      }

      return this.i < 0 ? -1 : 0;
   }

   public int s() {
      if (!this.h) {
         this.C();
      }

      return this.i < 0 ? -1 : 0;
   }

   public int v() {
      if (!this.h) {
         this.C();
      }

      return this.i;
   }

   public int w() {
      if (!this.h) {
         this.C();
      }

      return this.j;
   }

   private void C() {
      this.h = true;
      this.b.a = this.e;
      int var1 = this.c.a(this.b, -1, (short)-1, true, false);
      if (var1 < 0) {
         this.i = -1;
         this.j = -1;
      } else {
         this.i = this.b.a;
         this.b.a = this.f;
         var1 = this.c.a(this.b, var1, (short)this.i, true, true);
         if (this.i == this.j) {
            this.k = new zfv();
            this.c.a(var1, this.k);
            this.l = zaaq.a(this.k, this.a);
         }

         this.j = this.b.a - this.e;
         this.i -= this.e;
      }

   }
}
